function login(){
	var username = $("#txtuser").val();
	var pwd = $("#txtpwd").val();
	if (username == "" || username == null) {
		alert("请输入用户名！");
		return;
	}
	if (pwd == "" || pwd == null) {
		alert("请输入密码！");
		return;
	}
	$.ajax({
		url:"userLoginSub",
		type:"get",
		contentType:"application/json",
		dataType : 'json',
		async:true,
		data:{userName:username,psw:pwd},
		success:function(msg){
			var errmsg=msg.errorMsg;
			if(errmsg==""){
				isBindWx(username);
				var userid=$("#userid").val();
				if(userid!=""){
					document.cookie= "bigdata_userid="+userid+";path=/";
					location.href=$("#gotopage").val();
				}else{
					$("#errordiv").html("您的帐号尚未与汇客云微信公众号绑定，请绑定后再次尝试！");
				}
			}
			else{
				$("#errordiv").html(errmsg);
			}
		},
		error:function(xhr, type, exception){
			
		}
	});
}
function isBindWx(username){
	$.ajax({
		url:"getUserId",
		type:"get",
		contentType:"application/json",
		dataType : 'json',
		async:false,
		success:function(msg){
			str=msg.userid;
			$("#userid").val(str);
		}
	});
}